/**
 * <copyright>
 * </copyright>
 *
 */
package org.xtext.example.mydsl.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.myDsl.EnabledHigh;
import org.xtext.example.mydsl.myDsl.Mayor;
import org.xtext.example.mydsl.myDsl.MyDslPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Enabled High</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.EnabledHighImpl#getBool <em>Bool</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.EnabledHighImpl#getMayor <em>Mayor</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EnabledHighImpl extends AccionImpl implements EnabledHigh
{
  /**
   * The cached value of the '{@link #getBool() <em>Bool</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBool()
   * @generated
   * @ordered
   */
  protected org.xtext.example.mydsl.myDsl.Boolean bool;

  /**
   * The cached value of the '{@link #getMayor() <em>Mayor</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMayor()
   * @generated
   * @ordered
   */
  protected Mayor mayor;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EnabledHighImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.ENABLED_HIGH;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public org.xtext.example.mydsl.myDsl.Boolean getBool()
  {
    return bool;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetBool(org.xtext.example.mydsl.myDsl.Boolean newBool, NotificationChain msgs)
  {
    org.xtext.example.mydsl.myDsl.Boolean oldBool = bool;
    bool = newBool;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_HIGH__BOOL, oldBool, newBool);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBool(org.xtext.example.mydsl.myDsl.Boolean newBool)
  {
    if (newBool != bool)
    {
      NotificationChain msgs = null;
      if (bool != null)
        msgs = ((InternalEObject)bool).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_HIGH__BOOL, null, msgs);
      if (newBool != null)
        msgs = ((InternalEObject)newBool).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_HIGH__BOOL, null, msgs);
      msgs = basicSetBool(newBool, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_HIGH__BOOL, newBool, newBool));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Mayor getMayor()
  {
    return mayor;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetMayor(Mayor newMayor, NotificationChain msgs)
  {
    Mayor oldMayor = mayor;
    mayor = newMayor;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_HIGH__MAYOR, oldMayor, newMayor);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMayor(Mayor newMayor)
  {
    if (newMayor != mayor)
    {
      NotificationChain msgs = null;
      if (mayor != null)
        msgs = ((InternalEObject)mayor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_HIGH__MAYOR, null, msgs);
      if (newMayor != null)
        msgs = ((InternalEObject)newMayor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_HIGH__MAYOR, null, msgs);
      msgs = basicSetMayor(newMayor, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_HIGH__MAYOR, newMayor, newMayor));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_HIGH__BOOL:
        return basicSetBool(null, msgs);
      case MyDslPackage.ENABLED_HIGH__MAYOR:
        return basicSetMayor(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_HIGH__BOOL:
        return getBool();
      case MyDslPackage.ENABLED_HIGH__MAYOR:
        return getMayor();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_HIGH__BOOL:
        setBool((org.xtext.example.mydsl.myDsl.Boolean)newValue);
        return;
      case MyDslPackage.ENABLED_HIGH__MAYOR:
        setMayor((Mayor)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_HIGH__BOOL:
        setBool((org.xtext.example.mydsl.myDsl.Boolean)null);
        return;
      case MyDslPackage.ENABLED_HIGH__MAYOR:
        setMayor((Mayor)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_HIGH__BOOL:
        return bool != null;
      case MyDslPackage.ENABLED_HIGH__MAYOR:
        return mayor != null;
    }
    return super.eIsSet(featureID);
  }

} //EnabledHighImpl
